From 1ca58fa868ce790fb176c0817eb2e328232fa3ac Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Tue, 13 Apr 2021 11:33:53 -0600 Subject: [PATCH] restore lost format options when using positional parameters (#709) * restore format options with positional parameters. * fix positional test --- format.h | 10 ++++++++++ main.cc | 6 +++--- reference/dg200erase.bin | Bin 0 -> 111 bytes reference/dg200erase.log | 8 ++++++++ testo.d/dg100.test | 6 ++++++ vecs.cc | 2 ++ 6 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 reference/dg200erase.bin create mode 100644 reference/dg200erase.log diff --git a/format.h b/format.h index 63485383b..229e00620 100644 --- a/format.h +++ b/format.h @@ -181,8 +181,18 @@ public: name = nm; } + QString get_argstring() const + { + return argstring; + } + + void set_argstring(const QString& string) + { + argstring = string; + } private: QString name; + QString argstring; protected: template diff --git a/main.cc b/main.cc index 6de61fc2f..8847115f3 100644 --- a/main.cc +++ b/main.cc @@ -431,7 +431,7 @@ run(const char* prog_name) * When debugging, announce version. */ if (global_opts.debug_level > 0) { - warning("GPSBabel Version: %s \n", gpsbabel_version); + warning("GPSBabel Version: %s\n", gpsbabel_version); warning(MYNAME ": Compiled with Qt %s for architecture %s\n", QT_VERSION_STR, qPrintable(QSysInfo::buildAbi())); @@ -535,7 +535,7 @@ run(const char* prog_name) } /* reinitialize xcsv in case two formats that use xcsv were given */ - (void) Vecs::Instance().find_vec(ivecs->get_name()); + (void) Vecs::Instance().find_vec(ivecs->get_argstring()); cet_convert_init(ivecs->get_encode(), 1); @@ -548,7 +548,7 @@ run(const char* prog_name) if (qargs.size() == 2 && ovecs) { /* reinitialize xcsv in case two formats that use xcsv were given */ - (void) Vecs::Instance().find_vec(ovecs->get_name()); + (void) Vecs::Instance().find_vec(ovecs->get_argstring()); cet_convert_init(ovecs->get_encode(), 1); diff --git a/reference/dg200erase.bin b/reference/dg200erase.bin new file mode 100644 index 0000000000000000000000000000000000000000..7d77e1118208540fea14350b67474044889c536d GIT binary patch literal 111 zcmZ3mh=F-G0|UeE4VxD%VqgU^VI0Qo4BNq?dfOSn!cd~rfPq0>fPq1{${TMPDIR}/dg200erase.log 1>/dev/null +# Remove messages from main that depend on OS, Qt version, etc. +grep -v main: <${TMPDIR}/dg200erase.log | grep -v "GPSBabel Version" >${TMPDIR}/dg200erase_clean.log +compare ${REFERENCE}/dg200erase.log ${TMPDIR}/dg200erase_clean.log diff --git a/vecs.cc b/vecs.cc index 263146f8c..1a91991c7 100644 --- a/vecs.cc +++ b/vecs.cc @@ -272,6 +272,7 @@ Format* Vecs::find_vec(const QString& vecname) xcsv_fmt.xcsv_setup_internal_style(nullptr); #endif // CSVFMTS_ENABLED vec.vec->set_name(vec.name); /* needed for session information */ + vec.vec->set_argstring(vecname); /* needed for positional parameters */ return vec.vec; } @@ -319,6 +320,7 @@ Format* Vecs::find_vec(const QString& vecname) #endif // CSVFMTS_ENABLED vec_list[0].vec->set_name(svec.name); /* needed for session information */ + vec_list[0].vec->set_argstring(vecname); /* needed for positional parameters */ return vec_list[0].vec; } -- 2.30.2